from selenium.webdriver.common.by import By

from base.base_action import BaseAction


class NewConPage(BaseAction):
    alert_label = By.XPATH, "//*[@text='本地保存']"
    name_edit = By.XPATH, "//*[@text='姓名']"
    tel_edit = By.XPATH, "//*[@text='电话']"
    back_button = By.XPATH, "//*[@content-desc='向上导航']"

    def click_alert(self):
        self.click(self.alert_label)

    def input_name(self, text):
        self.send_keys(self.name_edit, text)

    def input_tel(self, text):
        self.send_keys(self.tel_edit, text)

    def click_back(self):
        self.click(self.back_button)
